{% extends "bootstrap/base.html" %}

{% block title %}好望角{% endblock %}

{% block head %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/viewer.min.css') }}">
{% endblock %}
{% block body_attribs %} style="padding-top:50px" {% endblock %}
{% block body %}

{{ super() }}

<div class="modal fade" id="MsgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<span id="msg_icon" class="glyphicon" aria-hidden="true"></span>				
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			</div>
			<div class="modal-body" id="msg"></div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

{% endblock %}
{% block navbar %}
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-expanded="false" aria-controls="navbar" >
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('home.index') }}">好望角二手车后台</a>
        </div>
        <div class="navbar-collapse collapse">
	    {% if current_user.is_authenticated %}
            <ul class="nav navbar-nav">

                {% if session['role'] not in ['upload', 'setup'] %}
		<li><a href="{{ url_for('home.index') }}">首页</a></li>
		{% endif %}

		{% if session['role'] in ['setup', 'super'] %}
                <li><a href="{{ url_for('siteset.carousel_index') }}">网设</a></li>
		{% endif %}
		
		{% if session['role'] in ['upload', 'review', 'admin', 'super'] %}
                <li><a href="{{ url_for('car.upload', car_type='old') if session['role']!='review' else url_for('car.review_list') }}">业务</a></li>
		{% endif %}

		{% if session['role'] in ['service', 'director', 'admin', 'super'] %}
                <li><a href="{{ url_for('track.buy_list') if session['role']=='service' else url_for('assign.assign_list') }}">跟进</a></li>
		{% endif %}
	
		{% if session['role'] not in ['hr', 'setup', 'upload'] %}
                <li><a href="{{ url_for('application.launch') }}">风控</a></li>
		{% endif %}

		{% if session['role'] not in ['manage', 'finance', 'setup', 'upload'] %}
                <li><a href="{{ url_for('org.org_list') if session['role']=='hr' else url_for('outside.individual_list') }}">账户</a></li>
		{% endif%}
		
		{% if session['role'] in ['hr', 'admin', 'super'] %}
                <li><a href="{{ url_for('safe.operation_record') }}">安全</a></li>
		{% endif %}

            </ul>
	    {% endif %}
            <ul class="nav navbar-nav navbar-right">
                {% if current_user.is_authenticated %}
                {% if session['role'] not in ['hr', 'upload', 'setup']%}
		<li>
                    <a href="{{ url_for('personal_center.loan') }}">
                        {{ session['name'] }}
                        <span style="display: none;" id="notification-message-all">
                            <img src="{{ url_for('static', filename='img/u134.png')}}">
                        </span>
                    </a>
                </li>
		{% endif %}
                <li><a href="{{ url_for('auth.logout') }}">退出</a></li>
                {% else %}
                <li><a href="{{ url_for('auth.login') }}">登录</a></li>
                {% endif %}
            </ul>
        </div>
    </div>
</nav>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='js/jquery-3.1.1.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/viewer.min.js') }}"></script>
 <script src="{{ url_for('static', filename='js/base_message.js') }}"></script>
<script>
var viewers = new Array();
$(document).ready(function(){
	var pics = document.getElementsByTagName('img');
	for(i=0;i< pics.length;i++){
		var viewer = new Viewer(pics[i], {'zIndex': 999999});
			viewers.push(viewer);
	}
})
</script>
{% endblock %}

